package com.anyext.storage.mapping.impl;

import java.util.Map;

import org.springframework.beans.factory.InitializingBean;

import com.anyext.storage.StorageContext;
import com.anyext.storage.group.Group;
import com.anyext.storage.mapping.PrimaryKey;
import com.anyext.storage.mapping.ResultMap;
import com.anyext.storage.mapping.SqlMap;
import com.anyext.storage.policy.SqlType;

public class SqlMapImpl implements SqlMap, InitializingBean {

	private String				identity;

	private SqlType				sqlType;

	private Group				group;

	private Map<String, String>	paramAlias;

	private PrimaryKey			primaryKey;

	private String				orginalSql;

	private ResultMap			resultMap;

	@Override
	public String getIdentity() {
		return identity;
	}

	public void setIdentity(String identity) {
		this.identity = identity;
	}

	@Override
	public SqlType getSqlType() {
		return sqlType;
	}

	public void setSqlType(SqlType sqlType) {
		this.sqlType = sqlType;
	}

	@Override
	public Group getGroup() {
		return group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	@Override
	public Map<String, String> getParamAlias() {
		return paramAlias;
	}

	public void setParamAlias(Map<String, String> paramAlias) {
		this.paramAlias = paramAlias;
	}

	@Override
	public PrimaryKey getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(PrimaryKey primaryKey) {
		this.primaryKey = primaryKey;
	}

	@Override
	public String getOrginalSql() {
		return orginalSql;
	}

	public void setOrginalSql(String orginalSql) {
		this.orginalSql = orginalSql;
	}

	@Override
	public ResultMap getResultMap() {
		return resultMap;
	}

	public void setResultMap(ResultMap resultMap) {
		this.resultMap = resultMap;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		StorageContext.addSqlMapName(this.identity);
	}

}
